// TOWN DIALOGUE SCRIPT
//    Town 129: Bavner

begintalkscript;

variables;

short i,j,k,r1,choice;

// Mother Loomis

begintalknode;
	tag = 40;
	state = -1;
	nextstate = 1;
	question = "Mother Loomis";
	text1 = "You meet a woman wearing the robe and rings of the Anama church. She has the air of not suffering fools gladly and the authority of a born leader. _I am Mother Loomis. Welcome to Bavner. I am the keeper of this town, and of our faith._";
	text5 = "Mother Loomis narrowly finds it worth her time to continue to speak with you. _It is good to have visitors to our temple._";
	action = INTRO;

begintalknode;
	state = 1;
	nextstate = 2;
	question = "_Are you in charge here?_";
	text1 = "_I am the guardian of Bavner. A trying job, I am sure you realize, but the faith gives me strength. Perhaps you would like to learn more of it?_";
	text3 = "_I am the guardian of Bavner. A trying job, I am sure you realize, but the faith gives me strength._ She notes your Anama rings and adds, _As I am sure your faith gives you strength._";
	code =
		if (has_spec_item(40) == 0)
			remove_string(3);
			else remove_string(1);
	break;

begintalknode;
	state = 2;
	nextstate = 3;
	question = "_What does being the guardian of Bavner mean?_";
	text1 = "She rolls her eyes. _One trial after another! As if the roaches weren't enough, I have to deal with Judith, and with Seela's ravings!_";
	text3 = "_Life has become much easier since the roach pit was destroyed, praise Ahonar. Still, there are diseases that still remain, so I must still deal with Judith._";
	action = DEP_ON_SDF 307 5 0;

begintalknode;
	state = 1;
	nextstate = 4;
	condition = has_spec_item(40) <= 0;
	question = "_Tell me about your faith._";
	text1 = "_The Anama teaches self-reliance above all things. We should rely on our own strength, not the energy from realms we do not understand, and from the summoning of bizarre creatures._";
	text2 = "_I have thought much on my beliefs. Would you like me to share one of my thoughts with you?_";

begintalknode;
	state = 4;
	nextstate = 1;
	question = "_Yes, please._";
	code =
		run_hardcode(126);
	break;

begintalknode;
	state = 4;
	nextstate = -1;
	condition = gf(127,1) == 0;
	question = "_No. I am not interested._";
	text1 = "_Fine,_ she says, irritated. _Then, if you will excuse me, I have work to attend to._";
	action = END_TALK;

begintalknode;
	state = 3;
	nextstate = -1;
	question = "_Who is Judith?_";
	text1 = "She frowns. _A profiteer! She's a healer who travels from town to town, healing for a hefty price! She's from some religion that values making money or amassing power or some such rot. I, as you can probably tell, despise her._";
	text2 = "_If, for some odd reason, you actually want to meet her, she comes through occasionally._";

begintalknode;
	state = 3;
	nextstate = 5;
	question = "_What is Seela raving about?_";
	text1 = "_As if all of our other trials did not provide worries enough, she says there are spiders in the woods who come and speak with her. She is around town somewhere if, for some odd reason, you want to ask her about it._";

begintalknode;
	state = 5;
	nextstate = -1;
	condition = gf(48,3) >= 1 && gf(307,5) == 0;
	question = "_Actually, there are friendly spiders out there. I have met them._";
	text1 = "_Hmmph. It is clear, in these stressful times, that madness is catching._";

begintalknode;
	state = 1;
	nextstate = 6;
	question = "_How is this area faring?_";
	text1 = "_The roaches weigh heavily upon us all. Though they rarely attack us directly, their diseases are a powerful and lethal weapon. Travel about Bigail, and you will see many signs of their destruction._";
	text3 = "_Better than it was, now that the roaches are growing scarce. Still, their diseases remain, and there will be much suffering before peace returns to this isle._";
	action = DEP_ON_SDF 307 5 0;

begintalknode;
	state = 6;
	nextstate = 1;
	condition = gf(129,11) <= 1;
	question = "_Is there any way I can help?_";
	text1 = "_Well, actually, since you are travelers, I feel I can ask one minor favor. Should you find a small shrine called Point Contemplation, please stop in and make sure everything there is all right._";
	text2 = "_I have been expecting a visit for some time from the head priest there, but I have heard no word from him. The point overlooks the water to the southwest._";
	action = SET_SDF 129 11 1;
	code =
		toggle_quest(40,1);
	break;
	
begintalknode;
	state = 6;
	nextstate = 1;
	question = "_Oh. Well, good luck._";
	text1 = "_Yes, and safe travels to you._";
	action = END_TALK;

begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(129,11) == 1 && gf(93,11) >= 1;
	question = "_I have been inside Point Contemplation. I'm afraid it has been destroyed._";
	code =
		run_hardcode(22);
	break;

begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(255,14) == 1;
	question = "_The innkeeper here stole a nephil's necklace._";
	text1 = "She looks uncomfortable. _I ... Well, there is only so much I can do about such a squabble. And there is only so much I can do to help a nephil. I'm sure you understand._";

// Seela

begintalknode;
	tag = 60;
	state = -1;
	nextstate = 29;
	question = "Seela";
	text1 = "You meet a young Anama priestess, more than happy to take a break from looking over the fields and picking weeds. _I'm Seela._";
	text5 = "Seela smiles, pleased to continue her break from the constant toil. _I am here to serve all._";
	action = INTRO;

begintalknode;
	state = 29;
	nextstate = 30;
	question = "_What is your job here in Bavner?_";
	text1 = "_I look after things. I watch the crops, patrol the woods, that sort of thing. And let me tell you, I see some strange things!_";

begintalknode;
	state = 30;
	nextstate = -1;
	question = "_Do you enjoy working with crops?_";
	text1 = "_It is more interesting work than you could possibly imagine,_ she says. Your delicate and well-tuned adventurer's senses detect a touch of sarcasm.";

begintalknode;
	state = 30;
	nextstate = 31;
	question = "_Why do you patrol the woods?_";
	text1 = "_We look for disease victims, giant spiders getting a little too close, roach infestations, that sort of thing._ She looks around to make sure nobody's listening in, then leans close to you.";
	text2 = "_Actually, the last few patrols, I've seen something very strange._";

begintalknode;
	state = 31;
	nextstate = 32;
	question = "_What strange things have you seen?_";
	text1 = "_There are intelligent spiders in the woods! And, what's more, they're friendly! They come and talk to me, and I give them little bugs in return. They're kind of sweet!_";

begintalknode;
	state = 32;
	nextstate = -1;
	question = "_Sweet, friendly, talking spiders?_";
	text1 = "_I know what you're thinking, but I'm not crazy. I tell you there are intelligent spiders in the forest. They say they have a big lair somewhere, but haven't told me where. They say they know all sorts of things about the roach plague._";
	text2 = "_If you went and were nice to them, I'm sure they'd talk to you too._";

begintalknode;
	state = 32;
	nextstate = -1;
	condition = gf(48,3) >= 1;
	question = "_I have been to the spiders' lair._";
	text1 = "_Have you? It is so nice to meet someone who doesn't think that I'm mad. I was almost ready to stop believing in it myself._";

begintalknode;
	state = 29;
	nextstate = -1;
	question = "_Can I buy some food from you?_";
	text1 = "_I am sorry. Even if the crops were ready, we only have enough here for the Anama. I am sorry._";
	text3 = "_Oh, I would love to provide provisions for a fellow Anama member, but the crops just aren't ready yet. Shayder is just down the road. You can provision yourselves there!_";
	code =
		if (has_spec_item(40) == 0)
			remove_string(3);
			else remove_string(1);
	break;

// Voorn

begintalknode;
	tag = 80;
	state = -1;
	nextstate = 57;
	question = "Voorn";
	text1 = "A stolid, massive man is slouched behind the counter. He looks dull and tired at first, but he is surrounded by books on a wide variety of topics. _I'm Voorn._";
	text5 = "Voorn slouches behind the book-laden counter.";
	action = INTRO;

begintalknode;
	state = 57;
	nextstate = 58;
	question = "_What sort of store is this?_";
	text1 = "_A store of learning. I am a teacher._";

begintalknode;
	state = 58;
	nextstate = 59;
	question = "_What do you teach?_";
	text1 = "_I train adventurers. Well, what adventurers come here anymore. I am schooled in all the adventuring skills, from military to religious training, and everything in between. If you want training, say so, and we'll go out back._";

begintalknode;
	state = 59;
	nextstate = -1;
	question = "_How do you manage to know so much about so many different topics?_";
	text1 = "_Teaching adventurers is very difficult, due to the wide variety of skills I need to keep up on. Still, somehow, I manage. I just don't get much sleep._";

begintalknode;
	state = 59;
	nextstate = -1;
	question = "_Perhaps you can train me._";
	text1 = "You conclude your training.";	
	code = 
		i = 5;
		if (has_spec_item(40) > 0)
			i = 1;
		begin_shop_mode("Voorn",
		  "Voorn can train you in a variety of adventuring skills. Those who wear the rings of the Anama get a discount.",
		  59,i,0);	
	break;

begintalknode;
	state = 59;
	nextstate = -1;
	condition = 1;
	question = "_I don't need any training._";
	text1 = "_OK. Zzzzzz._ Voorn immediately takes a nap.";
	action = END_TALK;



// Spurn

begintalknode;
	tag = 120;
	state = -1;
	nextstate = 120;
	question = "Spurn";
	text1 = "You meet the short, scruffy keeper of this crude inn. He shakes your hand, making sure you see his Anama ring. _I'm Spurn. Welcome to my humble little safehouse._";
	text5 = "Spurn says, _What do you want? I am here to help. All this splendor is at your disposal._ He waves to indicate the rows of empty pallets.";
	action = INTRO;
	
begintalknode;
	state = 120;
	nextstate = -1;
	question = "_I'd like some information._";
	text1 = "_I'm not a library. I'm not Anama. I just want to keep to myself. Need a bed for the night? I have that. Otherwise, leave me be._";

begintalknode;
	state = 120;
	nextstate = 121;
	question = "_How much is a bed?_";
	text1 = "_A mere three coins._";

begintalknode;
	state = 121;
	nextstate = 120;
	question = "_That much? No thank you._";
	text1 = "_Suit yourself. I assure you that the ground outside is much less comfortable._";


begintalknode;
	state = 121;
	nextstate = -1;
	condition = coins_amount() >= 3;
	question = "_I'll take it._ Pay three coins.";
	text1 = "The bed is uncomfortable and the accommodations are not the least bit private. You get little rest.";
	action = END_TALK;	
	code =
		revive_party();
		change_coins(-3);
		relocate_char(get_pc_id(0),17,11,FALSE);
		relocate_char(get_pc_id(1),18,11,FALSE);
		relocate_char(get_pc_id(2),18,12,FALSE);
		relocate_char(get_pc_id(3),17,12,FALSE);
	break;

begintalknode;
	state = 120;
	nextstate = 122;
	condition = gf(255,14) == 1 && gf(129,14) == 0;
	question = "_A nephil asked me to recover his necklace for him. I believe you have it._";
	text1 = "_Oh? And if I do? Look, that drunken kitty lost it to me in a dice game, fair and square. If you have a problem, well, you can just get out of my inn._";
	text2 = "You look him over, wondering you will be able to intimidate him into giving up the necklace.";
	text3 = "You have your doubts.";
	code =
		if (gf(307,5) > 0)
			rs(3);
	break;
	
begintalknode;
	state = 122;
	nextstate = -1;
	condition = gf(307,5) > 0;
	question = "_I destroyed the roach lair. I freed you from the plague. And I'd appreciate this favor._";
	action = END_TALK;
	code =
		run_hardcode(23);
	break;

begintalknode;
	state = 122;
	nextstate = -1;
	condition = get_prestige() < 13;
	question = "_You had better give me that necklace now. Or else._";
	text1 = "He smirks. _You? Threaten me? You just made a huge mistake! Guards!_";
	action = END_TALK;
	code =
		sf(129,13,1);
		make_zone_hostile();
	break;

begintalknode;
	state = 122;
	nextstate = -1;
	condition = get_prestige() >= 13;
	question = "_You had better give us that necklace now. Or else._";
	action = END_TALK;
	code =
		run_hardcode(24);
	break;
	
begintalknode;
	state = 122;
	nextstate = -1;
	question = "_Fine. I will go._";
	text1 = "_Good. And tell that kitty that, if we see him in town again, he'll get what's coming to him. Now get out of my inn._";
	action = END_TALK;
	
begintalknode;
	state = 120;
	nextstate = -1;
	question = "_I don't need anything._";
	text1 = "Spurn shrugs and returns to his work.";
	action = END_TALK;

